home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / games / IndiZone / sw / display.c++ < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.0 KB  |  67 lines

  1. /*
  2.  * Copyright (C) 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #include "sw.h"
  18. #include "extern.h"
  19. #include "display.h"
  20. #include "control.h"
  21. #include "resources.h"
  22. #include <Xm/Form.h>
  23.  
  24. Display*        display;
  25. Widget            mainWindow;
  26. SoXtRenderArea*        view;
  27.  
  28. Widget            makeDisplay(const char* title)
  29. {
  30.   mainWindow = SoXt::init(title,"Spacewar");        // make main window
  31.   display = SoXt::getDisplay();            // get the X display
  32.   setFallbacks(SoXt::getAppContext());        // set fallback resources
  33.   loadResources(mainWindow);            // get other resources
  34.  
  35.   // make form for main window
  36.   Widget wf = XmCreateForm(mainWindow, "", NULL, 0);
  37.  
  38.   view = new SoXtRenderArea;            // make view screen
  39.   view->setSize(SbVec2s(GAMEWIDTH, short(GAMEWIDTH/ASPECT)));
  40.   view->build(wf);
  41.  
  42.   Widget panel = makeControlPanel(wf);        // make control panel
  43.  
  44.   // set sizes and attachments for view screen and control panel
  45.   XtVaSetValues(panel,
  46.     XmNbottomAttachment,    XmATTACH_FORM,
  47.     XmNleftAttachment,    XmATTACH_FORM,
  48.     XmNrightAttachment,    XmATTACH_FORM,
  49.     XmNheight,        PANELHEIGHT,
  50.     NULL);
  51.   XtVaSetValues(view->getWidget(),
  52.     XmNtopAttachment,    XmATTACH_FORM,
  53.     XmNbottomAttachment,    XmATTACH_WIDGET,
  54.     XmNleftAttachment,    XmATTACH_FORM,
  55.     XmNrightAttachment,    XmATTACH_FORM,
  56.     XmNbottomWidget,    panel,
  57.     XmNleftWidget,        panel,
  58.     XmNrightWidget,        panel,
  59.     NULL);
  60.  
  61.   view->show();
  62.   SoXt::show(panel);
  63.   SoXt::show(wf);
  64.  
  65.   return mainWindow;
  66. }
  67.